package testIntergration;


import static org.junit.Assert.assertEquals;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Method;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import testUnit.testGame;
import FamilyTherapy.Game;
import FamilyTherapy.GCWindow;
import FamilyTherapy.Player;

public class testGame_move {

	@Before
	public void setUp() throws Exception {
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testMove() throws Exception {
		// preparation
		Player[] p = { new Player("a", 1), new Player("b", 2) };
		Game game = new Game();

		int currentPlayerNo = 0;
		int dice = 2;

		// output
		final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outContent));
		

		//private
		Game g = Game.class.newInstance();

		Method moveMethod = g.getClass().getDeclaredMethod("move", int.class, int.class, Player[].class);

		moveMethod.setAccessible(true);
		moveMethod.invoke(g, currentPlayerNo, dice, p);
		moveMethod.setAccessible(false);

		String expected = "a, you are in square [2].\n";
		assertEquals(expected, outContent.toString());
	}
}
